package com.xoa.service.event.impl;

import com.xoa.dao.event.TimeLineViewUserMapper;
import com.xoa.model.event.TimeLineViewUser;
import com.xoa.service.event.TimeLineViewUserService;
import com.xoa.util.ToJson;
import com.xoa.util.common.L;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by 张丽军 on 2017/9/1.
 */
@Service
public class TimeLineViewUserServiceImpl implements TimeLineViewUserService{

    @Resource
    TimeLineViewUserMapper timeLineViewUserMapper;
    @Override
    public ToJson<TimeLineViewUser> updateTimeLineViewUser(HttpServletRequest request, TimeLineViewUser timeLineViewUser) {
        ToJson<TimeLineViewUser> toJson=new ToJson<>(1,"error");
        /*try{
            int a=timeLineViewUserMapper.updateTimeLinePostRole(timeLineViewUser);
            if(a>0){
                toJson.setMsg("ok");
                toJson.setFlag(0);
            }else {
                toJson.setMsg("修改失败");
                toJson.setFlag(1);
            }
        }catch (Exception e){
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineViewUserServiceImpl updateTimeLinePostRole:"+e);
        }*/
        return toJson;
    }

    @Override
    public ToJson<TimeLineViewUser> addTimeLineViewUser(HttpServletRequest request, TimeLineViewUser timeLineViewUser) {
        ToJson<TimeLineViewUser> toJson=new ToJson<>(1,"error");
        try{
            int a=timeLineViewUserMapper.addTimeLineViewUser(timeLineViewUser);
            if(a>0){
                toJson.setMsg("ok");
                toJson.setFlag(0);
            }else {
                toJson.setMsg("修改失败");
                toJson.setFlag(1);
            }
        }catch (Exception e){
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineViewUserServiceImpl addTimeLineViewUser:"+e);
        }
        return toJson;
    }
}
